package composite_reuse

type BadProductDAO struct {
	BadDBConnection
}

func NewBadProductDAO(url string, uid string, pwd string) *BadProductDAO {
	return &BadProductDAO{
		*NewBadDBConnection(url, uid, pwd),
	}
}

func (me *BadProductDAO) Insert(it *Product) (error, int) {
	return me.Execute("insert into product(id,name,price) values(?, ?, ?)", it.ID, it.Name, it.Price)
}

func (me *BadProductDAO) Update(it *Product) (error, int) {
	return me.Execute("update product set name=? price=? where id=?", it.Name, it.Price, it.ID)
}

func (me *BadProductDAO) Delete(id int) (error, int) {
	return me.Execute("delete from product where id=?", id)
}